package edu.online.dal;

import edu.online.entity.SwitchStudentEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface SwitchStudentEntityMapper {
    @Delete({
        "delete from switchstudent",
        "where SwitchStudent = #{switchstudent,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(String switchstudent);

    @Insert({
        "insert into switchstudent (SwitchStudent, LessonScheduleID, ",
        "SwitchOrderID, StudentId, ",
        "IsApplier, LessonSchedule)",
        "values (#{switchstudent,jdbcType=CHAR}, #{lessonscheduleid,jdbcType=CHAR}, ",
        "#{switchorderid,jdbcType=CHAR}, #{studentid,jdbcType=CHAR}, ",
        "#{isapplier,jdbcType=BIT}, #{lessonschedule,jdbcType=CHAR})"
    })
    int insert(SwitchStudentEntity record);

    @InsertProvider(type=SwitchStudentEntitySqlProvider.class, method="insertSelective")
    int insertSelective(SwitchStudentEntity record);

    @Select({
        "select",
        "SwitchStudent, LessonScheduleID, SwitchOrderID, StudentId, IsApplier, LessonSchedule",
        "from switchstudent",
        "where SwitchStudent = #{switchstudent,jdbcType=CHAR}"
    })
    @Results({
        @Result(column="SwitchStudent", property="switchstudent", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="LessonScheduleID", property="lessonscheduleid", jdbcType=JdbcType.CHAR),
        @Result(column="SwitchOrderID", property="switchorderid", jdbcType=JdbcType.CHAR),
        @Result(column="StudentId", property="studentid", jdbcType=JdbcType.CHAR),
        @Result(column="IsApplier", property="isapplier", jdbcType=JdbcType.BIT),
        @Result(column="LessonSchedule", property="lessonschedule", jdbcType=JdbcType.CHAR)
    })
    SwitchStudentEntity selectByPrimaryKey(String switchstudent);

    @UpdateProvider(type=SwitchStudentEntitySqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(SwitchStudentEntity record);

    @Update({
        "update switchstudent",
        "set LessonScheduleID = #{lessonscheduleid,jdbcType=CHAR},",
          "SwitchOrderID = #{switchorderid,jdbcType=CHAR},",
          "StudentId = #{studentid,jdbcType=CHAR},",
          "IsApplier = #{isapplier,jdbcType=BIT},",
          "LessonSchedule = #{lessonschedule,jdbcType=CHAR}",
        "where SwitchStudent = #{switchstudent,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(SwitchStudentEntity record);
}